import { createChrome, deleteChrome, getChromeList, updateChrome } from "@main/db/model/chromeList";
import { T_ChromeListItem } from "@shared/types/chromeList";
import { ipcMain } from "electron";

export const initChromeListService = () => {
  ipcMain.handle("getChromeList", async (): Promise<any> => {
    return getChromeList();
  });
  ipcMain.handle("createChrome", async (_, args: T_ChromeListItem): Promise<any> => {
    return createChrome(args);
  });
  ipcMain.handle("updateChrome", async (_, id: string, args: T_ChromeListItem): Promise<any> => {
    return updateChrome(id, args);
  });
  ipcMain.handle("deleteChrome", async (_, id: string): Promise<any> => {
    return deleteChrome(id);
  });
};
